﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8" />
    <title>抄送规则</title>
    <!--SQL编辑器-->
    <link href="../../Scripts/CodeMirror/lib/codemirror.css" rel="stylesheet" />
    <link href="../../Scripts/CodeMirror/addon/hint/show-hint.css" rel="stylesheet" />
    <script src="../../Scripts/CodeMirror/lib/codemirror.js"></script>
    <script src="../../Scripts/CodeMirror/addon/edit/matchbrackets.js"></script>
    <script src="../../Scripts/CodeMirror/mode/sql/sql.js"></script>
    <script src="../../Scripts/CodeMirror/addon/hint/show-hint.js"></script>
    <script src="../../Scripts/CodeMirror/addon/hint/sql-hint.js"></script>
    <link href="../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <!--link href="../../Scripts/easyUI/themes/default/easyui.css" rel="stylesheet" type="text/css" /-->
    <link href="../../Scripts/easyUI145/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="../../Scripts/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <!-- 自己的系统风格统一. -->
    <link href="../../Style/skin/adminfont/iconfont.css" rel="stylesheet" />
    <link href="../../Style/skin/css/Default.css" rel="stylesheet" />
    <link href="../../Scripts/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <!-- 引用通用的js文件. -->
    <script type="text/javascript" src="../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../Comm/Gener.js"></script>
    <script src="../../Scripts/EasyUIUtility.js" type="text/javascript"></script>
    <script src="../Admin.js"></script>
    <style>
        td input[type=checkbox] {
            vertical-align:top; margin-top:0px; margin-right:5px;
        }
    </style>
    <script type="text/javascript" language="javascript">
        var nodeID = "";
        //页面启动函数.
        window.onload = function () {
            var mime = 'text/x-mariadb';
            // get mime type
            if (GetHrefUrl().indexOf('mime=') > -1) {
                mime = GetHrefUrl().substr(GetHrefUrl().indexOf('mime=') + 5);
            }
            window.editor = CodeMirror.fromTextArea(document.getElementById('TB_CCSQL'), {
                mode: mime,
                indentWithTabs: true,
                smartIndent: true,
                lineNumbers: true,
                matchBrackets: true,
                autofocus: true,
                extraKeys: { "Ctrl-Space": "autocomplete" },
                hintOptions: {
                    tables: {
                        users: ["name", "score", "birthDate"],
                        countries: ["name", "population", "size"]
                    }
                }
            });
        };
        $(function () {

            $("#Msg").html("正在加载,请稍后......");

            //初始化groupID.
            nodeID = GetQueryString("FK_Node");

            var node = new Entity("BP.WF.Template.CCEn.CC");
            node.NodeID = nodeID;
            node.Retrieve();
            console.log(node);
            //调用公共类库的方法:执行批量主表赋值
            GenerFullAllCtrlsVal(node);

            var FK_Flow = node.FK_Flow;

            var FK_MapData = "ND" + parseInt(FK_Flow) + "Rpt";

            var mapAttrs = new Entities("BP.Sys.MapAttrs", "FK_MapData", FK_MapData);

            //增加slect的节点值
            GenerBindDDL("DDL_CCFormAttr", mapAttrs, "KeyOfEn", "Name", node.CCFormAttr);


        });

        function WinOldStationOpen() {
            var url = "../../Comm/RefFunc/Dot2Dot.htm?EnName=BP.WF.Template.CCEn.CC&Dot2DotEnsName=BP.WF.Template.CCEn.CCStations&AttrOfOneInMM=FK_Node&AttrOfMInMM=FK_Station&EnsOfM=BP.Port.Stations&DefaultGroupAttrKey=FK_StationType&NodeID=" + nodeID + "&PKVal=" + nodeID + "&s=" + Math.random();
            OpenEasyUiDialogExt(url, '抄送岗位', 800, 500, true);
        }
        function WinNewStationOpen() {
            var url = "../../Comm/RefFunc/BranchesAndLeaf.htm?EnName=BP.WF.Template.CCEn.CC&Dot2DotEnsName=BP.WF.Template.CCEn.CCStations&Dot2DotEnName=BP.WF.Template.CCEn.CCStation&AttrOfOneInMM=FK_Node&AttrOfMInMM=FK_Station&EnsOfM=BP.Port.Stations&DefaultGroupAttrKey=FK_StationType&NodeID=" + nodeID + "&PKVal=" + nodeID + "&s=" + Math.random();

            OpenEasyUiDialogExt(url, '抄送岗位', 800, 500, true);
        }
        function WinDeptOpen() {

            var url = "../../Comm/RefFunc/Branches.htm?EnName=BP.WF.Template.CCEn.CC&Dot2DotEnsName=BP.WF.Template.CCEn.CCDepts&Dot2DotEnName=BP.WF.Template.CCEn.CCDept&AttrOfOneInMM=FK_Node&AttrOfMInMM=FK_Dept&EnsOfM=BP.Port.Depts&DefaultGroupAttrKey=&NodeID=" + nodeID + "&PKVal=" + nodeID + "&s=" + Math.random();


            OpenEasyUiDialogExt(url, "抄送部门", 800, 600, true);
        }

        function WinEmpOpen() {
            var url = "../../Comm/RefFunc/BranchesAndLeaf.htm?EnName=BP.WF.Template.CCEn.CC&Dot2DotEnsName=BP.WF.Template.CCEn.CCEmps&Dot2DotEnName=BP.WF.Template.CCEn.CCEmp&AttrOfOneInMM=FK_Node&AttrOfMInMM=FK_Emp&EnsOfM=BP.Port.Emps&DefaultGroupAttrKey=FK_Dept&NodeID=" + nodeID + "&PKVal=" + nodeID + "&s=" + Math.random();


            OpenEasyUiDialogExt(url, '抄送人员', 800, 500, true);
        }
        function Save() {

            var nodeID = GetQueryString("FK_Node");
            var node = new Entity("BP.WF.Template.CCEn.CC");
            node.SetPKVal(nodeID);
            node.Retrieve();

            node.CopyForm();

            node.CCWriteTo = $("#DDL_CCWriteTo").val();
            node.CCFormAttr = $("#DDL_CCFormAttr").val();
            node.NodeID = nodeID;
            node.Update();

            Reload();

        }
    </script>
</head>
<body>
    <div class="container-full">
        <div class="attrnode-bar-header">
            <span class="pull-right">
                <button id="Btn_Save" name="Btn_Save" onclick="Save();">保存</button>
            </span>
            <strong>抄送规则</strong>
        </div>
        <form id="cc">
          
            <div style="position:relative;">
                <table style="width:100%;" class="table">
                   
                    <tr>
                        <th colspan="2">
                            基本设置
                        </th>
                    </tr>
                    <tr>
                        <td class="style1">
                            抄送写入规则
                        </td>
                        <td>
                            <select name="DDL_CCWriteTo" id="DDL_CCWriteTo">
                                <option selected="selected" value="0">写入抄送列表</option>
                                <option value="1">写入待办</option>
                                <option value="2">写入待办与抄送列表</option>

                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th colspan="2">
                            自动抄送人范围
                        </th>
                    </tr>
                    <tr>
                        <td class="style1">
                            <input id="CB_CCIsAttr" type="checkbox" name="CB_CCIsAttr" /><label for="CB_CCIsAttr">按表单字段抄送？</label>
                        </td>
                        <td>
                            请选择设置抄送人员字段：<select id="DDL_CCFormAttr" name="DDL_CCFormAttr"></select>
                        </td>
                    </tr>

                    <tr>
                        <td class="style1">
                            <input id="CB_CCIsStations" type="checkbox" name="CB_CCIsStations" /><label for="CB_CCIsStations">抄送到岗位</label>
                        </td>
                        <td>
                            <a href="javascript:WinOldStationOpen()">
                                请选择岗位(旧)
                            </a>
                            <a href="javascript:WinNewStationOpen()">
                                请选择岗位(新)
                            </a>
                            岗位计算规则:<select name="DDL_CCStaWay" id="DDL_CCStaWay">
                                <option selected="selected" value="0">仅按岗位计算</option>
                                <option value="1">按岗位智能计算(当前节点)</option>
                                <option value="2">按岗位智能计算(发送到节点)</option>
                                <option value="3">按岗位与部门的交集</option>
                                <option value="4">按直线上级部门找岗位下的人员(当前节点)</option>
                                <option value="5">按直线上级部门找岗位下的人员(接受节点)</option>

                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="style1">
                            <input id="CB_CCIsDepts" type="checkbox" name="CB_CCIsDepts" /><label for="CB_CCIsDepts">抄送到部门</label>
                        </td>
                        <td>
                            <a href="javascript:WinDeptOpen()">
                                请选择部门(0)
                            </a>
                        </td>
                    </tr>
                    <tr>
                        <td class="style1">
                            <input id="CB_CCIsEmps" type="checkbox" name="CB_CCIsEmps" /><label for="CB_CCIsEmps">抄送到人员</label>
                        </td>
                        <td>
                            <a href="javascript:WinEmpOpen()">
                                请选择人员(0)
                            </a>
                        </td>
                    </tr>
                    <tr>
                        <td class="style1">
                            <input id="CB_CCIsSQLs" type="checkbox" name="CB_CCIsSQLs" /><label for="CB_CCIsSQLs">按照SQL设置范围</label>
                        </td>
                        <td>
                            <textarea name="TB_CCSQL" id="TB_CCSQL" style="width:638px; height: 113px;">
            </textarea>
                            <br />
                            <font color=gray>
                                您设置了按照SQL抄送，请您设置一个SQL语句，返回No,Name两个列,SQL支持ccbpm表达式。
                                <br />比如:SELECT No,Name FROM Port_Emp WHERE FK_Dept='@WebUser.FK_Dept'
                            </font>
                        </td>
                    </tr>
                </table>

            </div>

        </form>

    </div>

</body>
</html>
